/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.wiai.untl.core.dao.jpa;

import com.wiai.untl.core.dao.MatakuliahDAO;
import com.wiai.untl.core.entity.Departemen;
import com.wiai.untl.core.entity.Fakultas;
import com.wiai.untl.core.entity.Matakuliah;
import java.util.List;

/**
 *
 * @author Hendro Steven
 */
public class MatakuliahDAOImpl extends GeneralDAOImpl implements MatakuliahDAO {

    @Override
    public List<Matakuliah> getAllMatakuliah() {
       return getJpaTemplate().find("Select m From Matakuliah m");
    }

    @Override
    public List<Matakuliah> getByDepartemen(Departemen departemen) {
        return getJpaTemplate().find("Select m From Matakuliah m Where m.departemen=?1",departemen);
    }

    @Override
    public List<Matakuliah> getByFakultas(Fakultas fakultas) {
       return getJpaTemplate().find("Select m From Matakuliah m Where m.departemen.fakultas=?1",fakultas);
    }

    @Override
    public Matakuliah getById(long id) {
        return (Matakuliah)getJpaTemplate().find(Matakuliah.class, id);
    }
    
}
